package com.bb.blog.biz.manage.controller;


import com.alibaba.cloud.nacos.discovery.NacosDiscoveryClient;
import com.alibaba.nacos.api.exception.NacosException;
import com.alibaba.nacos.api.naming.pojo.ListView;
import com.alibaba.nacos.client.naming.NacosNamingService;
import com.bb.blog.web.component.ResponseUtil;
import com.bb.blog.web.model.CommonResponse;
import lombok.RequiredArgsConstructor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.LinkedList;
import java.util.List;

/**
 * 从namingService获取所有的的应用
 */
@RestController
@RequestMapping("/system")
@RequiredArgsConstructor
public class SystemController {
    private final Logger logger = LoggerFactory.getLogger(SystemController.class);
    private final DiscoveryClient discoveryClient;
    @GetMapping
    public  CommonResponse<Object> systemList(){
        List<String> services = discoveryClient.getServices();
        return ResponseUtil.success(services);
    }

}
